/*
 * FracSolvers.h
 *
 *  Created on: Oct 20, 2011
 *      Author: correa
 */

#ifndef FRACSOLVERS_H_
#define FRACSOLVERS_H_

#include "StabSolvers.h"

class FracColor : public RepColor {
	friend int branchCallback (CPXCENVptr env,
			void         *cbdata,
			int           wherefrom,
			void         *cbhandle,
			int           type,
			int           sos,
			int           nodecnt,
			int           bdcnt,
			const double *nodeest,
			const int    *nodebeg,
			const int    *indices,
			const char   *lu,
			const int    *bd,
			int          *useraction_p);
public:
	~FracColor();
	template <class M, class G>
	FracColor(Graph * g, ModelerFactory<M,G> * fm, int k);
	int solveByEnumeration();

    // Static class to create objects
    // Change is required only in this function to create a new object type
    template <class M, class G>
    static StabSolver * create(string relax, Graph * g, ModelerFactory<M,G> * fm, int k);
};

template <class M, class G>
inline StabSolver * FracColor::create(string relax, Graph * g, ModelerFactory<M,G> * fm, int k) {
	if (relax == "linear" || relax == "alinear")
		return new FracColor(g, fm, g->nverts());
	return NULL;
}


#endif /* FRACSOLVERS_H_ */
